<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>示例21</title>
    <script>
        const student = {
            name: '小雅',
            age: 19,
            // 对象的方法定义箭头函数不适合 
            showInfo: () => {
                setTimeout(() => {
                    console.log('我叫' + this.name + '我今年' + this.age + '岁');
                }, 1000);
            }
        }
        // 1 秒后控制台输出：我叫我今年 undefined 岁 
        student.showInfo();
    </script>
</head>

<body></body>

</html>